import java.util.*;

public class DataCollectAgent {

    public static void main( String args[] )
    {
	//MyApplication mapp = new MyApplication();
	CheckMail mapp = new CheckMail ();
	DataCollecter thread = new DataCollecter(mapp);
	thread.start();
    }
}

class DataCollecter extends Thread {

    private int sleepTime = 3000;
    private CheckMail my_app = null;

    public DataCollecter(CheckMail myapp )
    {
	super( "DataCollect" );
	my_app = myapp;
    }

   public void run()
   {
       for (int i=0; i<5; i++) {
	   try {
	       Thread.sleep(sleepTime); //3000 = 3 seconds
	   }
	   catch ( InterruptedException exception ) {
	       System.err.println( exception.toString() );
	   }

	   if (my_app != null) {
	       my_app.setAuthInfo("192.168.1.104","wli","NguyeLi5788");
	       System.out.println(my_app.getReturnMessage ());
	       //my_app.printInfo();
	   }
       }
   }
}

class MyApplication {
    public void printInfo() {
	System.out.println("Your application is running");
    }
}


